package resdto

import (
	"github.com/gogf/gf/v2/frame/g"
	"xr-game-server/core/constants/common"
	"xr-game-server/entity"
	"xr-game-server/module/protocol"
)

func NewResDto(db *entity.PlayerRes) *protocol.ItemModel {
	ret := &protocol.ItemModel{
		Id:  db.TypeId,
		Val: db.Val,
	}
	return ret
}

func NewArrayResDto(dbs []*entity.PlayerRes) []*protocol.ItemModel {
	ret := make([]*protocol.ItemModel, common.Zero)
	for _, db := range dbs {
		ret = append(ret, NewResDto(db))
	}
	return ret
}

type PushResReq struct {
	g.Meta `path:"/PushResReq" method:"post" dc:"命令:4" summary:"推送资源变更数据" tags:"货币"`
	Data   [][]uint64 `json:"data" dc:"物品数组"`
}

type PushResResp struct {
	Cmd  int32                 `json:"cmd" `
	Data []*protocol.ItemModel `json:"data" dc:"物品数值"`
}
